module colorizer(
	input clock, rst,
	input [1:0] world_pixel,
	input [1:0] icon_pixel,
	input video_on,
	output reg [2:0] vgaRed,		
	output reg [2:0] vgaGreen,
    output reg [2:1] vgaBlue
);

always @(posedge clock or posedge rst)
begin	
	
	if(rst) begin
		vgaRed <= 3'b111;
		vgaGreen <= 3'b111;
		vgaBlue <= 2'b11;
	end
	else if(video_on == 0) begin
		vgaRed <= 3'b000;
		vgaGreen <= 3'b000;
		vgaBlue <= 2'b000;		
	end
	else begin
		if(video_on) begin
			case(icon_pixel[1:0])
				2'b00	:	begin 
							
								case(world_pixel[1:0])
									2'b00	:	begin						// background
													vgaRed <= 3'b111;
													vgaGreen <= 3'b111;
													vgaBlue <= 2'b11;
												end
									2'b01	:	begin						// black line
													vgaRed <= 3'b000;
													vgaGreen <= 3'b000;
													vgaBlue <= 2'b00;
												end
									2'b10	:	begin						// obstruction 
													vgaRed <= 3'b111;
													vgaGreen <= 3'b000;
													vgaBlue <= 2'b00;
												end
									2'b11	:	begin						// reserved blue 
													vgaRed <= 3'b000;
													vgaGreen <= 3'b000;
													vgaBlue <= 2'b00;
												end
											
									endcase
				
							end
				2'b01	:	begin 
								vgaRed <= 3'b000;
								vgaGreen <= 3'b000;
								vgaBlue <= 2'b11;
							end
				2'b10	:	begin 
								vgaRed <= 3'b111;
								vgaGreen <= 3'b000;
								vgaBlue <= 2'b00;
							end
				2'b11	:	begin 
								vgaRed <= 3'b111;
								vgaGreen <= 3'b111;
								vgaBlue <= 2'b00;
							end
			endcase
		end
	end

end
endmodule